part of 'index.dart';

class ConversationPage extends StatefulWidget {
  const ConversationPage({super.key});

  @override
  State<ConversationPage> createState() => _ConversationPageState();
}

class _ConversationPageState extends State<ConversationPage> {
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (_) => ConversationProvider(),
      child: Container(
        clipBehavior: Clip.hardEdge,
        padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 18),
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(20),
        ),
        child: Consumer<ConversationProvider>(
          builder: (context, provider, child) {
            return SlidableAutoCloseBehavior(
              child: CustomScrollView(
                slivers: [
                  const _TopBar().sliver,
                  ServiceCard(
                    avatar: Images.icChatVolume,
                    title: T.current.c_plt_notice,
                    subTitle: 'The Content Of The Message....',
                    count: provider.countModel?.PROCLAMATION_ADMIN,
                    onTap: () {
                      provider.jumpToPlatformNotice();
                    },
                  ).sliver,
                  ServiceCard(
                    avatar: Images.icChatNotifications,
                    title: T.current.c_sys_notice,
                    subTitle: 'The Content Of The Message....',
                    onTap: () {
                      provider.jumpToSystemNotice();
                    },
                    count: provider.countModel?.NOTICE_ADMIN,
                  ).sliver,
                  // ServiceCard(
                  //   avatar: Images.icChatService,
                  //   title: T.current.c_custom_service,
                  //   subTitle: 'The Content Of The Message....',
                  //   onTap: () {
                  //     provider.jumpToCustomer();
                  //   },
                  //   count: provider.countModel?.CUSTOMER_ADMIN,
                  // ).sliver,
                  SliverList.builder(
                    itemBuilder: (context, index) {
                      return ConversationCard(provider.conversations[index]);
                    },
                    itemCount: provider.conversations.length,
                  ),
                ],
              ),
            );
          },
        ),
      ),
    );
  }
}
